<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>

<html>
    <head>
	<title>Site Administration</title>
<link rel="stylesheet" href="../default.css">
        <script language="javascript" src="../chk.js"></script>
    </head>
    
    <body class="main">
        <p class="crumbs"><a href="index.jsp">Website Administration</a> &gt; Add a Chat Room</p>
        
        <h1>
Chat
        </h1>
        
        <h2>Add a Chat Room</h2>
        <br>
        
        <p>To add a chat room to the website, give the chat room a
            <i>name</i> and a brief <i>description</i> (so people know the topic of the chat.)
        Then, choose the <i>groups</i> or <i>users</i> who are allowed to participate in the chat.</p> 
        
        <br>
        
        <form id="chatform" method="post" action="SubmitChat.jsp">
            <table border="0" cellpadding="6">
                <tr>
                    <td valign="top" bgcolor="ddddff"><strong>1. Name of chat room:</strong></td>
                    <td><input type="text" name="cname" id="cname" size="40" /></td>
                </tr>
                <tr>
                    <td valign="top" bgcolor="ddddff"><strong>2. Brief description:</strong><br><i>(optional)</i></td>
                    <td><textarea name="cdesc" id="cdesc" rows="5" cols="40"></textarea></td>
                </tr>
                <tr>
                    <td valign="top" bgcolor="ddddff"><strong>3. Type of chat:</strong></td>
                    <td>                
                        <input type="radio" name="chatType" value="expert" checked="checked" /> <strong>Expert Chat</strong> - a brief, moderated chat; automatically closes after 24 hours.<br>
                        <input type="radio" name="chatType" value="open" /> <strong>Open Chat</strong> - a chat that is left open indefinitely.<br>
                    </td>
                </tr>
                <tr>
                    <td valign="top" bgcolor="ddddff"><strong>4. Who may participate?</strong></td>
                    <td>                
                        <input type="radio" name="cauth" value="0" checked="checked" onClick="document.getElementById('groups').style.display='none'; document.getElementById('users').style.display='none';" /> Everyone<br>
                        <input type="radio" name="cauth" value="1" onClick="document.getElementById('groups').style.display=''; document.getElementById('users').style.display='none';"/> Only certain <i>groups</i><br>
                        <br/>
                        <div id="groups" style="display:none;">
                            <span style="color:990000"><strong>Choose the groups that may participate in the chat:</strong></span><br/>
                            
                            <%                
                            db.DatabaseConnector DBConnect = new db.DatabaseConnector(db.DatabaseConnector.getDatabaseType());
                            String[][] rs = DBConnect.selectSQL("ROLES", new String[] {"*"});
                            
                            for (int i=0;i<rs.length;i++) {
                                String group = rs[i][0];
                                if(!group.equals("chat")) {
                                    out.print("<input type=\"checkbox\" name=\"cgroup\"");
                                    if(group.contains("admin")) {
                                        out.print("checked=\"checked\" ");
                                    }
                                    out.println("value=\"" + group + "\" /> " + group + "<br/>");
                                }
                            }
                            %>
                        </div>
                    </td>
                </tr>
            </table>
            
            <br/>
            
            <input type="button" name="Add Chat Room" value="Add Chat Room" onClick="checkform();" />
            <input type="button" value=" Cancel " onClick="parent.mainFrame.location='index.jsp'">
        </form>
        
        <p>&nbsp;</p>
        
<hr><p align='center'>&copy; 2007 SIS<br>
Site maintained by <a href="mailto:spring@pitt.edu">MBSpring</a><br>
Phone</p>

        
    </body>
</html>
